#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

#define MAXN 100001
int cnt = 1, power = 0;
int ans = 0;
int head[MAXN], nxt[MAXN << 1], to[MAXN << 1];
int vertex[MAXN];

int deep[MAXN];
int stjump[MAXN][17];

int log2(int n)
{
	int ans = 0;
	while ((1 << ans) <= (n >> 1)) {
		ans++;
	}
	return ans;
}

void addedge(int u, int v)
{
	nxt[cnt] = head[u];
	to[cnt] = v;
	head[u] = cnt++;
}

void dfs(int u, int p)
{
	deep[u] = deep[p] + 1;
	stjump[u][0] = p;
	for (int p = 1; p <= power; p++) {
		stjump[u][p] = stjump[stjump[u][p - 1]][p - 1];
	}
	for (int e = head[u], v; e; e = nxt[e]) {
		v = to[e];
		if (v != p) {
			dfs(v, u);
		}
	}
}

int lca(int u, int v)
{
	if (deep[u] < deep[v]) {
		swap(u, v);
	}

	int k = deep[u] - deep[v];
	for (int p = log2(k); p >= 0; p--) {
		if (deep[stjump[u][p]] >= deep[v]) {
			u = stjump[u][p];
		}
	}
	if (u == v) {
		return u;
	}

	k = deep[v];
	for (int p = log2(k); p >= 0; p--) {
		if (stjump[u][p] != stjump[v][p]) {
			u = stjump[u][p];
			v = stjump[v][p];
		}
	}
	return stjump[u][0];
}

void dfs2(int u, int p, int m)
{
	for (int e = head[u], v, w; e; e = nxt[e]) {
		v = to[e];
		if (v != p) {
			dfs2(v, u, m);
			// w = vertex[v];
			// if(w == 0){
			//         ans += m;
			// }else if( w == 1){
			//         ans += 1;
			// }
			// vertex[u] += w;
		}
	}
	for (int e = head[u], v, w; e != 0; e = nxt[e]) {
		v = to[e];
		if (v != p) {
			w = 0 + vertex[v];
			if (w == 0) {
				ans += m;
			} else if (w == 1) {
				ans += 1;
			} else {
				ans += 0;
			}
			vertex[u] += vertex[v];
		}
	}
}

void App(int n, int m)
{
	cnt = 1;
	ans = 0;
        power = log2(n);

	for (int i = 0, u, v; i < n - 1; i++) {
		scanf("%d%d", &u, &v);
		addedge(u, v);
		addedge(v, u);
	}

	dfs(1, 0);

	for (int i = 0, u, v, c; i < m; i++) {
		scanf("%d%d", &u, &v);
		c = lca(u, v);
		vertex[u]++;
		vertex[v]++;
		vertex[c] -= 2;
	}
	dfs2(1, 0, m);
	printf("%d\n", ans);
}

int main()
{
	int n = 0, m = 0;
	scanf("%d%d", &n, &m);
        App(n, m);
	return 0;
}